from flask import Blueprint, jsonify, request
from mock.server_response import ServerMockResponse

server_bp = Blueprint('server', __name__)

@server_bp.route('/detect', methods=['POST'])
def detect_objects():
    """处理物体识别请求"""
    data = request.json
    if not data or 'image' not in data:
        return jsonify({'error': '缺少图像数据'}), 400
    return jsonify(ServerMockResponse.get_detect_response()), 200

@server_bp.route('/logistics', methods=['POST'])
def process_logistics():
    """处理物流查询请求"""
    data = request.json
    if not data or 'image' not in data:
        return jsonify({'error': '缺少图像数据'}), 400
    return jsonify(ServerMockResponse.get_logistics_response()), 200

@server_bp.route('/navigation', methods=['POST'])
def process_navigation():
    """处理导航请求"""
    data = request.json
    if not data or 'image' not in data:
        return jsonify({'error': '缺少图像数据'}), 400
    return jsonify(ServerMockResponse.get_navigation_response()), 200